package com.bean;

public class PageBean {
    int total;//总行数
    int pages;//页
    int curpage;//当前页
    int size=10;//每页几行
    int begin,end; //开始和结束
    public int getTotal() {
        return total;
    }
    public void setTotal(int total) {
        this.total = total;
        pages =total/size;
        if (total%size!=0) {
            pages++;
        }
    }
    public int getPages() {
        return pages;
    }
    public void setPages(int pages) {
        this.pages = pages;
    }
    public int getCurpage() {
        return curpage;
    }
    public void setCurpage(int curpage) {
        this.curpage = curpage;
        if (pages<=10) {
            begin=1;
            end=pages;
        }else{
            begin =curpage-5;
            end =curpage+4;
            if (begin<=0) {
                begin=1;
                end=10;
            }
            if (end>pages) {
                begin=pages-9;
                end=pages;
            }
        }

    }
    public int getSize() {
        return size;
    }
    public void setSize(int size) {
        this.size = size;
    }
    public int getBegin() {
        return begin;
    }
    public void setBegin(int begin) {
        this.begin = begin;
    }
    public int getEnd() {
        return end;
    }
    public void setEnd(int end) {
        this.end = end;
    }
    @Override
    public String toString() {
        return "PageBean [total=" + total + ", pages=" + pages + ", curpage="
                + curpage + ", size=" + size + ", begin=" + begin + ", end="
                + end + "]";
    }
    public PageBean(int total, int pages, int curpage, int size, int begin,
                    int end) {
        super();
        this.total = total;
        this.pages = pages;
        this.curpage = curpage;
        this.size = size;
        this.begin = begin;
        this.end = end;
    }
    public PageBean() {
        super();
    }



}

